#include <iostream>
#include <cmath>
using namespace std;

int goUpstairs(int total)
{
    if (total == 1)
    {
        return 1;
    }
    else if (total == 2)
    {
        return 2;
    }
    else if (total == 3)
    {
        return 4;
    }
    else
        return goUpstairs(total - 1) + goUpstairs(total - 2) + goUpstairs(total - 3);
}

int main()
{
    int total_upstairs;
    cin >> total_upstairs;
    cout << goUpstairs(total_upstairs);
    return 0;
}